/*
 * A hash function of string can be give; 
 *
 * @param a string 
 * @param a table size
 * @return a hash value;
 */
#include <string>
#include <iostream>
using namespace std;
int hash(const string &key,int tableSize){
	int hashValue = 0; 
	for(int i = 0; i<key.length(); i++){
		hashValue = 37*hashValue + key[i];
	}
	hashValue %= tableSize; 
	if(hashValue < 0){
		hashValue += tableSize; 
	}
	return hashValue; 
}	

int main(){
	std::cout << hash("helloworld",10) << endl;
}
